<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>DEMO FLEX_WRAP</title>
    <style>
        body{
            display: flex;
            flex-flow: row wrap;
            justify-content: space-evenly;
        }
        .container{
            width: 300px;
            height: 300px;
            background-color: lightblue;
            display: flex;
        }
        .container div{
            width: 100px;
            height: 100px;
            border: 1px solid black;
            box-sizing: border-box;
            color: wh
        }
        .container div:nth-child(1){
            background-color: lightcoral;
        }
        .container div:nth-child(2){
            background-color: lightgreen;
        }
        .container div:nth-child(3){
            background-color: lightsalmon;
        }
        .container div:nth-child(4){
            background-color: lightpink;
        }
        .nowrap{
            flex-wrap: nowrap;
        }
        .wrap{
            flex-wrap: wrap;
        }
        .wrap-reverse{
            flex-wrap: wrap-reverse;
        }
    </style>
</head>
<body>
    <div>
        <h3>flow-wrap: nowrap</h3>
        <h4> 不换行，如果排不开则压缩 </h4>
        <div class="container nowrap">
            <div>item1</div>
            <div>item2</div>
            <div>item3</div>
            <div>item4</div>
        </div>
    </div>
    <div>
        <h3>flow-wrap: wrap</h3>
        <h4> 换行，如果排不下，向下换行 </h4>
        <div class="container wrap">
            <div>item1</div>
            <div>item2</div>
            <div>item3</div>
            <div>item4</div>
        </div>
    </div>

    <div>
        <h3>flow-wrap: wrap-reverse</h3>
        <h4> 换行，如果排不下，反向换行 </h4>
        <div class="container wrap-reverse">
            <div>item1</div>
            <div>item2</div>
            <div>item3</div>
            <div>item4</div>
        </div>
    </div>
</body>
</html>